<template>
  <div class="p-4">
    <h2>文章管理测试页面</h2>
    <el-button type="primary" @click="testAdd">测试新增文章</el-button>
    <el-button type="success" @click="testEdit">测试编辑文章</el-button>
    
    <ArticleEditDialog 
      v-model="dialogVisible" 
      :article-data="currentArticle" 
      @success="handleSuccess" 
    />
  </div>
</template>

<script setup>
import { ref } from 'vue'
import ArticleEditDialog from './modules/ArticleEditDialog.vue'

const dialogVisible = ref(false)
const currentArticle = ref(null)

const testAdd = () => {
  currentArticle.value = null
  dialogVisible.value = true
}

const testEdit = () => {
  currentArticle.value = {
    id: 1,
    title: '测试文章',
    content: '这是测试内容'
  }
  dialogVisible.value = true
}

const handleSuccess = () => {
  console.log('操作成功')
}
</script> 